﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 流程控制关键字
{
    internal class Program
    {
        //continue    跳过本次循环,继续下次循环
        private static void Main1(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                if (i == 5)
                {
                    continue; //跳过5
                }
                Console.WriteLine(i);
            }
        }
        //break        跳出整个循环
        private static void Main(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                if (i == 5)
                {
                    break; //跳出循环
                }
                Console.WriteLine(i);
            }
            Console.WriteLine("OK");//会执行
            Console.Read();
        }
        //return 退出方法,
        private static void Main3(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                if (i == 5)
                {
                    return; //退出Main方法
                }
                Console.WriteLine(i);
            }
            Console.WriteLine("OK");//不会执行
        }
    }
}